//
// Created by jason on 2025/4/19.
//
#pragma once

#include <exception>
#include <string>
#include <sstream>

using namespace std;

class BA330ConnectionException : public exception {

private:
    string message_;

public:
    BA330ConnectionException &operator=(const BA330ConnectionException &) = delete;

    BA330ConnectionException(const BA330ConnectionException &) = delete;

    BA330ConnectionException(const string &file, int lineNumber, const char *description) {
        stringstream ss;
        ss << description << ", file " << file << ", line " << lineNumber << ".";
        message_ = ss.str();
        LOGE("BA330ConnectionException: %s", message_.c_str());
    }

    const char *what() {
        return message_.c_str();
    }
};

class BA330CommunicationException : public exception {

private:
    string message_;

public:
    BA330CommunicationException &operator=(const BA330CommunicationException &) = delete;

    BA330CommunicationException(const BA330CommunicationException &) = delete;

    BA330CommunicationException(const string &file, int lineNumber, const char *description) {
        stringstream ss;
        ss << description << ", file " << file << ", line " << lineNumber << ".";
        message_ = ss.str();
        LOGE("BA330CommunicationException: %s", message_.c_str());
    }

    const char *what() {
        return message_.c_str();
    }
};




